package com.fss.cmsContent.service;

import java.util.List;
import java.util.Map;

import com.fss.common.dao.CommonDao;
import com.fssDataModels.TbCmsContent;
import com.opensymphony.xwork2.ActionContext;


public class CmsContentServiceImpl implements CmsContentService{

	private CommonDao commonDao;

	@Override
	public void getCMSContent() {
		List<TbCmsContent> CmsList =this.commonDao.getCmsContents();
		Map session = ActionContext.getContext().getSession();
		for(TbCmsContent cmsContent : CmsList){
			session.put(cmsContent.getCmsId().trim(), cmsContent);
		}
	}

	@Override
	public int editCMSContent(List<TbCmsContent> cmsContentList) {
		if(this.commonDao.updateCmsContents(cmsContentList)==1){
			Map session = ActionContext.getContext().getSession();
			for(TbCmsContent cmsContent : cmsContentList){
				session.put(cmsContent.getCmsId().trim(), cmsContent);
			}
			return 1;
		}else{
			return 0;
		}
	}

	@Override
	public int addExperienceType(String experienceType) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int deleteExperienceType(int typeId) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int deleteExperienceTypeList(String[] typeIdList) {
		// TODO Auto-generated method stub
		return 0;
	}

	public CommonDao getCommonDao() {
		return commonDao;
	}

	public void setCommonDao(CommonDao commonDao) {
		this.commonDao = commonDao;
	}
	
	
	
	
}